
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>0. 系统设计面试指南 · GitBook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        
        
        
    
    <link rel="stylesheet" href="gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="ch1.html" />
    
    
    <link rel="prev" href="./" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="./">
            
                <a href="./">
            
                    
                    译者
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.2" data-path="ch0.html">
            
                <a href="ch0.html">
            
                    
                    0. 系统设计面试指南
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="ch1.html">
            
                <a href="ch1.html">
            
                    
                    1. 设计类似TinyURL的短链服务
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="ch2.html">
            
                <a href="ch2.html">
            
                    
                    2. 设计 Pastebin
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="ch3.html">
            
                <a href="ch3.html">
            
                    
                    3. 设计Instagram
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="ch4.html">
            
                <a href="ch4.html">
            
                    
                    4. 设计Dropbox
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="ch5.html">
            
                <a href="ch5.html">
            
                    
                    5. 设计Facebook Messager
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="ch7.html">
            
                <a href="ch7.html">
            
                    
                    7. 设计YouTube或Netflix
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9" data-path="ch9.html">
            
                <a href="ch9.html">
            
                    
                    9.设计API限流器
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10" data-path="ch23.html">
            
                <a href="ch23.html">
            
                    
                    CAP理论
            
                </a>
            

            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="." >0. 系统设计面试指南</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="0&#x7CFB;&#x7EDF;&#x8BBE;&#x8BA1;&#x9762;&#x8BD5;&#x6307;&#x5357;">0.&#x7CFB;&#x7EDF;&#x8BBE;&#x8BA1;&#x9762;&#x8BD5;&#x6307;&#x5357;</h1>
<p>&gt;</p>
<h2 id="&#x5355;&#x4F4D;&#x6362;&#x7B97;&#x8868;">&#x5355;&#x4F4D;&#x6362;&#x7B97;&#x8868;</h2>
<pre><code class="lang-java"><span class="hljs-number">1</span>B  = <span class="hljs-number">8</span> bit         <span class="hljs-keyword">byte</span>
<span class="hljs-number">1</span>KB = <span class="hljs-number">1024</span>bytes     Kilobyte  
<span class="hljs-number">1</span>MB = <span class="hljs-number">1024</span>KB        Megabyte   <span class="hljs-comment">//&#x767E;&#x4E07;&#x5B57;&#x8282; &#x5146;</span>
<span class="hljs-number">1</span>GB = <span class="hljs-number">1024</span>MB        Gigabyte   <span class="hljs-comment">//&#x4EBF;&#x5B57;&#x8282;&#xFF0C;&#x53C8;&#x79F0;&#x201C;&#x5343;&#x5146;&#x201D;</span>
<span class="hljs-number">1</span>TB = <span class="hljs-number">1024</span>GB        Terabyte   <span class="hljs-comment">//&#x4E07;&#x4EBF;&#x5B57;&#x8282;&#xFF0C;&#x592A;&#x5B57;&#x8282;</span>
<span class="hljs-number">1</span>PB = <span class="hljs-number">1024</span>TB        Petabyte   <span class="hljs-comment">// &#x5343;&#x4E07;&#x4EBF;&#x5B57;&#x8282;&#xFF0C;&#x62CD;&#x5B57;&#x8282;</span>
<span class="hljs-number">1</span>EB  =<span class="hljs-number">1024</span>PB        Exabyte    <span class="hljs-comment">//&#x767E;&#x4EBF;&#x4EBF;&#x5B57;&#x8282;&#xFF0C;&#x827E;&#x5B57;&#x8282;</span>
...
<span class="hljs-number">1</span>GB = <span class="hljs-number">10</span>^<span class="hljs-number">8</span> bytes
</code></pre>
<pre><code class="lang-java"><span class="hljs-number">1</span>&#x5343;&#x4E07; = <span class="hljs-number">10</span>  million
<span class="hljs-number">1</span>&#x4EBF;   = <span class="hljs-number">100</span> million
<span class="hljs-number">10</span>&#x4EBF;  = <span class="hljs-number">1</span>   billion
</code></pre>
<h2 id="&#x6982;&#x5FF5;">&#x6982;&#x5FF5;</h2>
<h3 id="qps-&#x548C;-tps">QPS &#x548C; TPS</h3>
<ul>
<li><strong>QPS&#xFF08;Query Per Second&#xFF09;</strong> &#xFF1A;&#x670D;&#x52A1;&#x5668;&#x6BCF;&#x79D2;&#x53EF;&#x4EE5;&#x6267;&#x884C;&#x7684;&#x67E5;&#x8BE2;&#x6B21;&#x6570;&#xFF1B;</li>
<li><strong>TPS&#xFF08;Transaction Per Second&#xFF09;</strong> &#xFF1A;&#x670D;&#x52A1;&#x5668;&#x6BCF;&#x79D2;&#x5904;&#x7406;&#x7684;&#x4E8B;&#x52A1;&#x6570;&#xFF08;&#x8FD9;&#x91CC;&#x7684;&#x4E00;&#x4E2A;&#x4E8B;&#x52A1;&#x53EF;&#x4EE5;&#x7406;&#x89E3;&#x4E3A;&#x5BA2;&#x6237;&#x53D1;&#x51FA;&#x8BF7;&#x6C42;&#x5230;&#x6536;&#x5230;&#x670D;&#x52A1;&#x5668;&#x7684;&#x8FC7;&#x7A0B;&#xFF09;&#xFF1B;</li>
</ul>
<h3 id="&#x541E;&#x5410;&#x91CF;">&#x541E;&#x5410;&#x91CF;</h3>
<p><strong>&#x541E;&#x5410;&#x91CF;&#x6307;&#x7684;&#x662F;&#x7CFB;&#x7EDF;&#x5355;&#x4F4D;&#x65F6;&#x95F4;&#x5185;&#x7CFB;&#x7EDF;&#x5904;&#x7406;&#x7684;&#x8BF7;&#x6C42;&#x6570;&#x91CF;&#x3002;</strong></p>
<p>&#x4E00;&#x4E2A;&#x7CFB;&#x7EDF;&#x7684;&#x541E;&#x5410;&#x91CF;&#x4E0E;&#x8BF7;&#x6C42;&#x5BF9;&#x7CFB;&#x7EDF;&#x7684;&#x8D44;&#x6E90;&#x6D88;&#x8017;&#x7B49;&#x7D27;&#x5BC6;&#x5173;&#x8054;&#x3002;&#x8BF7;&#x6C42;&#x5BF9;&#x7CFB;&#x7EDF;&#x8D44;&#x6E90;&#x6D88;&#x8017;&#x8D8A;&#x591A;&#xFF0C;&#x7CFB;&#x7EDF;&#x541E;&#x5410;&#x80FD;&#x529B;&#x8D8A;&#x4F4E;&#xFF0C;&#x53CD;&#x4E4B;&#x5219;&#x8D8A;&#x9AD8;&#x3002;</p>
<p>TPS&#x3001;QPS&#x90FD;&#x662F;&#x541E;&#x5410;&#x91CF;&#x7684;&#x5E38;&#x7528;&#x91CF;&#x5316;&#x6307;&#x6807;&#x3002;</p>
<ul>
<li><strong>QPS&#xFF08;TPS&#xFF09;</strong> = &#x5E76;&#x53D1;&#x6570;/&#x5E73;&#x5747;&#x54CD;&#x5E94;&#x65F6;&#x95F4;(RT)</li>
<li><strong>&#x5E76;&#x53D1;&#x6570;</strong> = QPS * &#x5E73;&#x5747;&#x54CD;&#x5E94;&#x65F6;&#x95F4;(RT)</li>
</ul>
<h3 id="&#x7CFB;&#x7EDF;&#x6D3B;&#x8DC3;&#x5EA6;">&#x7CFB;&#x7EDF;&#x6D3B;&#x8DC3;&#x5EA6;</h3>
<h4 id="pvpage-view">PV(Page View)</h4>
<blockquote>
<p>&#x8BBF;&#x95EE;&#x91CF;, &#x5373;&#x9875;&#x9762;&#x6D4F;&#x89C8;&#x91CF;&#x6216;&#x70B9;&#x51FB;&#x91CF;&#xFF0C;&#x8861;&#x91CF;&#x7F51;&#x7AD9;&#x7528;&#x6237;&#x8BBF;&#x95EE;&#x7684;&#x7F51;&#x9875;&#x6570;&#x91CF;&#xFF1B;&#x5728;&#x4E00;&#x5B9A;&#x7EDF;&#x8BA1;&#x5468;&#x671F;&#x5185;&#x7528;&#x6237;&#x6BCF;&#x6253;&#x5F00;&#x6216;&#x5237;&#x65B0;&#x4E00;&#x4E2A;&#x9875;&#x9762;&#x5C31;&#x8BB0;&#x5F55;1&#x6B21;&#xFF0C;&#x591A;&#x6B21;&#x6253;&#x5F00;&#x6216;&#x5237;&#x65B0;&#x540C;&#x4E00;&#x9875;&#x9762;&#x5219;&#x6D4F;&#x89C8;&#x91CF;&#x7D2F;&#x8BA1;&#x3002;UV &#x4ECE;&#x7F51;&#x9875;&#x6253;&#x5F00;&#x7684;&#x6570;&#x91CF;/&#x5237;&#x65B0;&#x7684;&#x6B21;&#x6570;&#x7684;&#x89D2;&#x5EA6;&#x6765;&#x7EDF;&#x8BA1;&#x7684;&#x3002;</p>
</blockquote>
<h4 id="uvunique-visitor">UV(Unique Visitor)</h4>
<blockquote>
<p>&#x72EC;&#x7ACB;&#x8BBF;&#x5BA2;&#xFF0C;&#x7EDF;&#x8BA1;1&#x5929;&#x5185;&#x8BBF;&#x95EE;&#x67D0;&#x7AD9;&#x70B9;&#x7684;&#x7528;&#x6237;&#x6570;&#x3002;1&#x5929;&#x5185;&#x76F8;&#x540C;&#x8BBF;&#x5BA2;&#x591A;&#x6B21;&#x8BBF;&#x95EE;&#x7F51;&#x7AD9;&#xFF0C;&#x53EA;&#x8BA1;&#x7B97;&#x4E3A;1&#x4E2A;&#x72EC;&#x7ACB;&#x8BBF;&#x5BA2;&#x3002;UV &#x662F;&#x4ECE;&#x7528;&#x6237;&#x4E2A;&#x4F53;&#x7684;&#x89D2;&#x5EA6;&#x6765;&#x7EDF;&#x8BA1;&#x7684;&#x3002;</p>
</blockquote>
<h4 id="daudaily-active-user">DAU(Daily Active User)</h4>
<blockquote>
<p>&#x65E5;&#x6D3B;&#x8DC3;&#x7528;&#x6237;&#x6570;&#x91CF;&#x3002;</p>
</blockquote>
<h4 id="maumonthly-active-users">MAU(monthly active users)</h4>
<blockquote>
<p> &#x6708;&#x6D3B;&#x8DC3;&#x7528;&#x6237;&#x4EBA;&#x6570;&#x3002;</p>
</blockquote>
<h4 id="&#x4E3E;&#x4F8B;&#xFF1A;">&#x4E3E;&#x4F8B;&#xFF1A;</h4>
<p>&#x67D0;&#x7F51;&#x7AD9; DAU&#x4E3A; 1200w&#xFF0C; &#x7528;&#x6237;&#x65E5;&#x5747;&#x4F7F;&#x7528;&#x65F6;&#x957F; 1 &#x5C0F;&#x65F6;&#xFF0C;RT&#x4E3A;0.5s&#xFF0C;&#x6C42;&#x5E76;&#x53D1;&#x91CF;&#x548C;QPS&#x3002;</p>
<p>&#x5E73;&#x5747;&#x5E76;&#x53D1;&#x91CF; = DAU&#xFF08;1200w&#xFF09;* &#x65E5;&#x5747;&#x4F7F;&#x7528;&#x65F6;&#x957F;&#xFF08;1 &#x5C0F;&#x65F6;&#xFF0C;3600&#x79D2;&#xFF09; /&#x4E00;&#x5929;&#x7684;&#x79D2;&#x6570;&#xFF08;86400&#xFF09;=1200w/24 = 50w</p>
<p>&#x771F;&#x5B9E;&#x5E76;&#x53D1;&#x91CF;&#xFF08;&#x8003;&#x8651;&#x5230;&#x67D0;&#x4E9B;&#x65F6;&#x95F4;&#x6BB5;&#x4F7F;&#x7528;&#x4EBA;&#x6570;&#x6BD4;&#x8F83;&#x5C11;&#xFF09; = DAU&#xFF08;1200w&#xFF09;* &#x65E5;&#x5747;&#x4F7F;&#x7528;&#x65F6;&#x957F;&#xFF08;1 &#x5C0F;&#x65F6;&#xFF0C;3600&#x79D2;&#xFF09; /&#x4E00;&#x5929;&#x7684;&#x79D2;&#x6570;-&#x8BBF;&#x95EE;&#x91CF;&#x6BD4;&#x8F83;&#x5C0F;&#x7684;&#x65F6;&#x95F4;&#x6BB5;&#x5047;&#x8BBE;&#x4E3A;8&#x5C0F;&#x65F6;&#xFF08;57600&#xFF09;=1200w/16 = 75w</p>
<p>&#x5CF0;&#x503C;&#x5E76;&#x53D1;&#x91CF; = &#x5E73;&#x5747;&#x5E76;&#x53D1;&#x91CF; * 6 = 300w</p>
<p>QPS = &#x771F;&#x5B9E;&#x5E76;&#x53D1;&#x91CF;/RT = 75W/0.5=100w/s</p>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="./" class="navigation navigation-prev " aria-label="Previous page: 译者">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="ch1.html" class="navigation navigation-next " aria-label="Next page: 1. 设计类似TinyURL的短链服务">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"0. 系统设计面试指南","level":"1.2","depth":1,"next":{"title":"1. 设计类似TinyURL的短链服务","level":"1.3","depth":1,"path":"ch1.md","ref":"ch1.md","articles":[]},"previous":{"title":"译者","level":"1.1","depth":1,"path":"README.md","ref":"README.md","articles":[]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":[],"pluginsConfig":{"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"ch0.md","mtime":"2022-03-14T12:20:25.735Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2022-03-18T00:21:24.649Z"},"basePath":".","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="gitbook/gitbook.js"></script>
    <script src="gitbook/theme.js"></script>
    
        
        <script src="gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

